<div id="description1">This tests to see if BackColor can be performed on a caret selection. The text typed afterword should have the new background color.</div>
<div id="edit1" contentEditable="true"></div>

<div id="description2">This tests to see if ForeColor can be performed in a plaintext-only region. The text typed afterword should not have the requested color.</div>
<div id="edit2" contentEditable="plaintext-only"></div>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

edit1 = document.getElementById("edit1");
edit1.focus();
document.execCommand("BackColor", false, "#00F");
document.execCommand("InsertText", false, "Blue");

edit2 = document.getElementById("edit2");
edit2.focus();
document.execCommand("ForeColor", false, "#00F");
document.execCommand("InsertText", false, "Black");

if (window.testRunner)
    document.body.innerText = document.getElementById("description1").innerText + "\n" + edit1.innerHTML + "\n\n" +
                              document.getElementById("description2").innerText + "\n" + edit2.innerHTML;
</script>
